/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.strategy.vo;


import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.pig4cloud.pigx.common.customize.utils.serializer.BigDecimalToPlainStringSerializer;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 策略仓位-合约
 *
 * @since 2022-11-24 10:39:27
 */
@Data
public class StrategyPositionContractVO extends Model<StrategyPositionContractVO> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 用户id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    /**
     * 任务id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long taskId;

    /**
     * 方向（0做多、1做空）
     */
    private String side;

    /**
     * 开仓数量
     */
    private Integer numOpen;

    /**
     * 当前持仓数量
     */
    private Integer numNow;

    /**
     * 平仓数量
     */
    private Integer numClose;

    /**
     * 止盈止损数量
     */
    private Integer numStopOrder;

    /**
     * 开仓均价
     */
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal avgOpen;

    /**
     * 平仓均价
     */
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal avgClose;

    /**
     * 保证金
     */
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal margin;

    /**
     * 利润（USDT）
     */
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal profit;

    /**
     * 净利润（USDT）
     */
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal netProfit;

    /**
     * 异常结算利润（USDT）
     */
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal errorSettlementProfit;

    /**
     * 手续费（USDT）
     */
    @JsonSerialize(using = BigDecimalToPlainStringSerializer.class)
    private BigDecimal handlingFee;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    private LocalDateTime updateTime;

    /**
     * 状态（0无持仓、1持仓中、2已平仓、3加仓中、4平仓中）
     */
    private String status;


}
